package cn.edu.cqupt.cxcy.action;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.edu.cqupt.cxcy.dao.AdminDao;
import cn.edu.cqupt.cxcy.dto.AdminImpl;
import cn.edu.cqupt.cxcy.util.Validate;

/**
 * 主页-【场地预约】
 * @author Dancer-mno
 * @date 2015年10月17日
 */
@SuppressWarnings("serial")
public class AdminNavExamPro extends HttpServlet {

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		this.doPost(req, resp);
	}

	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		int pid = Validate.stringIsNO(request.getParameter("pid"))?Integer.parseInt(request.getParameter("pid")) : 0; //类别
		int id = Validate.stringIsNO(request.getParameter("id"))?Integer.parseInt(request.getParameter("id")) : 0;
		String opin = request.getParameter("opin");
		AdminDao admin = new AdminImpl();
		//  主url /admin/examPro
		//    admin/examPro?pid=?&&id=?&&opin=? 项目审核 pid为项目id，id为 审核是否通过编号，opin为意见
		
		response.setContentType("text/html;charset=utf-8");
		response.setHeader("pragma","no-cache");
		response.setHeader("cache-control","no-cache");
		PrintWriter out = response.getWriter();
		out.print( admin.examPro( pid, id, opin));
		out.flush();
		out.close();
	}
}
